obj.a = wbuffer_create()
wbuffer_write_int8(obj.a,-10)
assert((wbuffer_get_cursor(obj.a) == 1))
wbuffer_write_int16(obj.a,-1122)
assert((wbuffer_get_cursor(obj.a) == 3))
wbuffer_write_int32(obj.a,-11223344)
assert((wbuffer_get_cursor(obj.a) == 7))
wbuffer_write_int64(obj.a,-1122334455667788)
assert((wbuffer_get_cursor(obj.a) == 15))
wbuffer_write_string(obj.a,"hello")
assert((wbuffer_get_cursor(obj.a) == 21))
wbuffer_write_binary(obj.a,"wolrd",6)
assert((wbuffer_get_cursor(obj.a) == 27))
obj.b = rbuffer_create(wbuffer_get_data(obj.a),wbuffer_get_cursor(obj.a))
assert((rbuffer_get_capacity(obj.b) == wbuffer_get_cursor(obj.a)))
assert((rbuffer_get_cursor(obj.b) == 0))
assert((rbuffer_read_int8(obj.b) == -10))
assert((rbuffer_get_cursor(obj.b) == 1))
assert((rbuffer_read_int16(obj.b) == -1122))
assert((rbuffer_get_cursor(obj.b) == 3))
assert((rbuffer_read_int32(obj.b) == -11223344))
assert((rbuffer_get_cursor(obj.b) == 7))
rbuffer_read_int64(obj.b)
assert((rbuffer_get_cursor(obj.b) == 15))
assert((rbuffer_read_string(obj.b) == "hello"))
assert((rbuffer_get_cursor(obj.b) == 21))
obj.c = rbuffer_read_binary(obj.b,6)
assert((rbuffer_get_cursor(obj.b) == 27))
assert(rbuffer_rewind(obj.b))
assert(rbuffer_skip(obj.b,1))
assert((rbuffer_get_cursor(obj.b) == 1))
assert((rbuffer_read_int16(obj.b) == -1122))
wbuffer_rewind(obj.a)
assert((wbuffer_get_cursor(obj.a) == 0))
wbuffer_write_binary(obj.a,obj.c)
assert((wbuffer_get_cursor(obj.a) == 6))
unset("a")
unset("b")
